Skip to content

Commit

Permalink
[ADD] Implement weight calculation based on product weight
Browse files Browse the repository at this point in the history
  • Loading branch information
danimaribeiro committed Oct 30, 2019
1 parent 27b4248 commit 0ad172e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions br_nfe/models/invoice_eletronic.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ def _prepare_eletronic_invoice_item(self, item, invoice):
if item.tem_difal:
imposto['ICMSUFDest'] = {
'vBCUFDest': "%.02f" % item.icms_bc_uf_dest,
'vBCFCPUFDest': "%.02f" % item.icms_bc_uf_dest,
'pFCPUFDest': "%.02f" % item.icms_aliquota_fcp_uf_dest,
'pICMSUFDest': "%.02f" % item.icms_aliquota_uf_dest,
'pICMSInter': "%.02f" % item.icms_aliquota_interestadual,
Expand Down
8 changes: 8 additions & 0 deletions br_sale_stock/models/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ def _amount_all(self):
order.total_despesas,
})

@api.multi
def _prepare_invoice(self):
res = super(SaleOrder, self)._prepare_invoice()
res['weight'] = sum(
[x.qty_to_invoice * x.product_id.weight for x in self.order_line])
res['weight_net'] = res['weight']
return res

def _calc_ratio(self, qty, total):
if total > 0:
return qty / total
Expand Down

0 comments on commit 0ad172e

Please sign in to comment.