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

Hi,

We have a requirement where the GST has to be used as Group Tax and has to be equally distributed. For example GST 18% will have a group of CGST as 9% and SGST as 9%. For that we want to use the python code.


Under SGST 9% and CGST 9% python code I want use the following condition;

For example Product website listed price is 399 then the Sales Order should have Untaxed amount as 338.13 and CGST 30.43 and SGST 30.43. These numbers we can get it by doing the following equation, i.e. product_price/1.18 = 399/1.18=338.13. Then remaining amount will be for tax 300-338.13=60.87. That will be further divided by 2, 60.87/2=30.43.

Product Price = 399

Untaxed Amount = 338.13

CGST = 30.43

SGST = 30.43

Not able to put the same in python code. Any help or guidance in the above requested will be really appreciated.

아바타
취소
작성자


I tried using the shared code as shown above, but I am getting the following error;


image0


Please will appreciate your kind guidance.

베스트 답변

Hi 

You can try the following code 

By inheriting the sale.order.line, Here is an example


class SaleOrderLineInherit(models.Model):
_inherit='sale.order.line'

price_untaxed = fields.Float(compute='_compute_untaxed_price', store=True)
cgst = fields.Float(compute='_compute_cgst', store=True)
sgst = fields.Float(compute='_compute_sgst', store=True)

@api.depends('price_unit')
def _compute_untaxed_price(self):
for rec in self:
rec.price_untaxed = rec.price_unit / 1.18

@api.depends('price_untaxed')
def _compute_cgst(self):
for rec in self:
rec.cgst = (rec.price_unit - rec.price_untaxed) / 2

@api.depends('price_untaxed')
def _compute_sgst(self):
for rec in self:
rec.sgst = (rec.price_unit - rec.price_untaxed) / 2


Regards

아바타
취소
작성자

Thanks a lot Bella for your response.

I tried as per your guidance but it did not work. Please, I have shared the screenshots for your kind reference.

관련 게시물 답글 화면 활동
0
11월 23
1039
1
11월 22
3309
0
8월 22
2036
0
3월 15
3796
1
2월 25
495