Browse Source

[FIX] Few remarks from Virgine and Nicolas

pull/13/head
Thibault Francois 9 years ago
parent
commit
f2e086066b
  1. 3
      beesdoo_coda/__init__.py
  2. 1
      beesdoo_coda/models/__init__.py
  3. 12
      beesdoo_coda/models/bank_statement.py
  4. 4
      beesdoo_product/data/product_label.xml
  5. 24
      beesdoo_product/models/beesdoo_product.py
  6. 1
      beesdoo_product/views/beesdoo_product.xml

3
beesdoo_coda/__init__.py

@ -1,2 +1,3 @@
# -*- coding: utf-8 -*-
import wizard
import wizard
import models

1
beesdoo_coda/models/__init__.py

@ -0,0 +1 @@
import bank_statement

12
beesdoo_coda/models/bank_statement.py

@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
'''
Created on 16 mai 2016
@author: Thibault Francois (thibault@françois.be)
'''
from openerp import models, fields
class BankStatement(models.Model):
_inherit = 'account.bank.statement'
coda_note = fields.Text()

4
beesdoo_product/data/product_label.xml

@ -61,5 +61,9 @@
<field name="type">delivery</field>
<field name="color_code">#ff4000</field>
</record>
<record id="consignes_group_tax" model="account.tax.group">
<field name="name">Consignes</field>
<field name="sequence" eval="10" />
</record>
</data>
</odoo>

24
beesdoo_product/models/beesdoo_product.py

@ -13,12 +13,13 @@ class BeesdooProduct(models.Model):
main_seller_id = fields.Many2one('res.partner', compute='_compute_main_seller_id', store=True)
display_unit = fields.Many2one('product.uom', required=True, default=lambda self: self.env.ref('product.product_uom_kgm'))
default_reference_unit = fields.Many2one('product.uom', required=True, default=lambda self: self.env.ref('product.product_uom_kgm'))
display_unit = fields.Many2one('product.uom')
default_reference_unit = fields.Many2one('product.uom')
display_weight = fields.Float(compute='_get_display_weight', store=True)
total_with_vat = fields.Float(compute='_get_total_with_vat', store=True)
total_with_vat_by_unit = fields.Float(compute='_get_total_with_vat_by_unit', store=True)
total_with_vat = fields.Float(compute='_get_total', store=True, string="Total Sales Price with VAT")
total_with_vat_by_unit = fields.Float(compute='_get_total', store=True, string="Total Sales Price with VAT by Reference Unit")
total_deposit = fields.Float(compute='_get_total', store=True, string="Deposit Price")
@api.one
@api.depends('seller_ids', 'seller_ids.date_start')
@ -28,15 +29,12 @@ class BeesdooProduct(models.Model):
self.main_seller_id = sellers_ids and sellers_ids[0].name or False
@api.one
@api.depends('taxes_id', 'list_price')
def _get_total_with_vat(self):
tax_amount_sum = sum([tax.amount for tax in self.taxes_id])
self.total_with_vat = self.list_price * (100.0 + tax_amount_sum) / 100
@api.one
@api.depends('total_with_vat', 'display_weight', 'weight')
def _get_total_with_vat_by_unit(self):
print self.display_weight, self.total_with_vat, self.weight
@api.depends('taxes_id', 'list_price', 'taxes_id.amount', 'taxes_id.tax_group_id', 'total_with_vat', 'display_weight', 'weight')
def _get_total(self):
consignes_group = self.env.ref('beesdoo_product.consignes_group_tax')
tax_amount_sum = sum([tax._compute_amount(self.list_price, self.list_price) for tax in self.taxes_id if tax.tax_group_id != consignes_group])
self.total_deposit = sum([tax._compute_amount(self.list_price, self.list_price) for tax in self.taxes_id if tax.tax_group_id == consignes_group])
self.total_with_vat = self.list_price + tax_amount_sum
if self.display_weight > 0:
self.total_with_vat_by_unit = self.total_with_vat / self.weight

1
beesdoo_product/views/beesdoo_product.xml

@ -31,6 +31,7 @@
<field name="display_unit" />
<field name="default_reference_unit"/>
<field name="total_with_vat_by_unit" />
<field name="total_deposit" />
</group>
<group>
<field name="main_seller_id" />

Loading…
Cancel
Save