콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
4 답글
4812 화면

Hi,

I'm using Odoo 9 and I would like to add a value to amount_total from pos_order.

I tried different things that didn't work as for example inherit _amount_all or use the write function on self.pool.get('pos.order').browse(cr, uid, ids, context=context).

Please help me.

Thanks.

아바타
취소
베스트 답변

amount total is function/compute fields ,

As compute fields not store in db so you can modify it with the write.

you can override the function associated with the compute filed to modify it's value.  

  'amount_total': fields.function(_amount_all, string='Total', digits_compute=dp.get_precision('Account'),  multi='all'),

override  _amount_all  method .


아바타
취소
작성자

Currently, my code is this : def _amount_all(self, cr, uid, ids, name, args, context=None): res = super(pos_order, self)._amount_all(cr, uid, ids, name, args, context) for order in self.browse(cr, uid, ids, context=context): res[order.id]['amount_total'] += 42 return res But the value "42" isn't added to amount_total. Can you help me please ?

작성자 베스트 답변

Thank you, I understood more that amount_total is generated by _amount_all.

So, I tried to inherit as you said but I think I did something wrong.
Here is my code :

def _amount_all(self, cr, uid, ids, name, args, context=None):

res = super(pos_order, self)._amount_all(cr, uid, ids, name, args, context)

for order in self.browse(cr, uid, ids, context=context):

      res[order.id]['amount_total'] += order.coupon_nb

return res

 

아바타
취소
작성자

Should I override the attributes in "_columns" or the xml view ? Cause it doesn't work for the moment...

베스트 답변

Hello,

I hope everyone is in good health. I am trying Odoo for test purposes.  I have created the sales order of about 6 items and I assigned them to the different team. My question is that is there any way that I can create the invoice for all 6 items separately from only one account? I have created two invoices of the sales order from two different accounts i.e. Administrator and demo account but for that I had to delete rest of the items in the list and after doing that I was unable to create any more invoice for that sales order from those account. I want to know if I can create separate invoice for all the items.

아바타
취소
관련 게시물 답글 화면 활동
0
5월 16
4731
15
5월 16
7080
2
4월 23
4855
2
3월 20
12625
1
1월 24
2243