Sage Intacct API创建的供应商发票:API返回Pending但UI显示Submitted
Sage Intacct API创建供应商发票状态不一致问题排查与解决
问题背景
通过Sage Intacct API调用create_potransaction接口创建供应商发票,请求中明确指定<state>Pending</state>,API响应返回发票状态为Pending,但在Sage Intacct UI中该发票状态显示为Submitted。需要发票处于Pending状态以获取编辑权限。
请求XML代码如下:
<?xml version="1.0" encoding="UTF-8"?> <request> <control> <senderid>{{sender_id}}</senderid> <password>{{sender_password}}</password> <controlid>{{$timestamp}}</controlid> <uniqueid>false</uniqueid> <dtdversion>3.0</dtdversion> <includewhitespace>false</includewhitespace> </control> <operation> <authentication> <sessionid>{{temp_session_id}}</sessionid> </authentication> <content> <function controlid="{{$guid}}"> <create_potransaction> <transactiontype>Vendor Invoice</transactiontype> <datecreated> <year>2013</year> <month>6</month> <day>19</day> </datecreated> <vendorid>1001</vendorid> <referenceno>12345</referenceno> <vendordocno>vendordocno001</vendordocno> <shippingmethod></shippingmethod> <returnto> <contactname></contactname> </returnto> <payto> <contactname></contactname> </payto> <basecurr>CAD</basecurr> <currency>CAD</currency> <exchratetype>Intacct Daily Rate</exchratetype> <customfields/> <state>Pending</state> <potransitems> <potransitem> <itemid>75300GL</itemid> <quantity>2</quantity> <unit>Each</unit> <price>1</price> <locationid>E100</locationid> </potransitem> </potransitems> <subtotals> <subtotal> <description>Freight 75300GL</description> <total>8.73</total> <absval>9.22</absval> </subtotal> <subtotal> <description>Tax Amt</description> <total>2</total> <absval>8.73</absval> </subtotal> </subtotals> </create_potransaction> </function> </content> </operation> </request>
可能的原因排查
- 自动提交规则触发:账套可能配置了供应商发票自动提交规则,当满足特定条件(如金额范围、供应商类型、交易日期)时,系统自动将
Pending状态的发票转为Submitted。可在【应付账款】>【配置】>【供应商发票设置】中查看相关配置。 - 账套强制提交配置:部分账套会设置全局规则,要求所有供应商发票必须提交,此时API请求中的
state参数会被系统覆盖,强制设置为Submitted。 - 历史日期交易的特殊处理:请求中
datecreated为2013年的历史日期,部分账套对历史交易有锁定机制,自动将其标记为Submitted以防止修改。 - 小计字段逻辑异常:请求中
subtotals里的absval值与total值逻辑不符(如第一个subtotal的total=8.73但absval=9.22,第二个total=2但absval=8.73),系统可能因验证通过后触发自动提交逻辑。
解决方案
- 关闭自动提交规则:登录Sage Intacct UI,进入供应商发票配置页面,禁用所有自动提交的规则或条件,重新发起API请求测试。
- 修正小计字段逻辑:调整
subtotals中的absval值,使其与total的绝对值保持一致(例如将第一个subtotal的absval改为8.73,第二个改为2),避免系统因数值异常触发状态变更。 - 测试当前日期发票:将
datecreated改为当前日期,重新创建发票,验证状态是否同步为Pending,排除历史日期的特殊处理影响。 - 调用更新接口修正状态:若发票已创建,可使用
update_potransaction接口修改状态,示例请求片段如下:
<function controlid="update-invoice-status"> <update_potransaction> <recordno>【目标发票的recordno】</recordno> <state>Pending</state> </update_potransaction> </function>
- 确认账号权限与账套配置:检查API使用的账号是否拥有创建
Pending状态发票的权限,同时确认账套未设置强制提交供应商发票的全局规则。
内容的提问来源于stack exchange,提问作者MUHAMMED SHAFEERALI P
相关产品推荐
相关产品推荐

