class ManufacturingOrder(models.Model):
_inherit = 'mrp.production'
analytic_account_id = fields.Many2one(string='Analytic Account', comodel_name='account.analytic.account')
@api.multi
def button_mark_done(self):
for order in self:
for move in order.move_finished_ids:
move.analytic_account_id = order.analytic_account_id
res = super(ManufacturingOrder, self).button_mark_done()
return res
重写_prepare_stock_moves方法,该方法为一个订单行准备库存移动数据,并返回准备在
stock.move's create()
中使用的字典列表要从采购订单中获取字段值,请使用反向_name
order_id
编辑:
要在生产订单上使用相同的逻辑,可以在将订单标记为已完成时设置帐户:
相关问题 更多 >
编程相关推荐