Browse Source

[MIG] pos_margin: Migration to 13.0

pull/399/head
MurtazaMithaiwala 5 years ago
parent
commit
016a373867
  1. 1
      pos_margin/README.rst
  2. 2
      pos_margin/__manifest__.py
  3. 1
      pos_margin/models/pos_order.py
  4. 1
      pos_margin/models/pos_order_line.py
  5. 1
      pos_margin/readme/CONTRIBUTORS.rst
  6. 4
      pos_margin/readme/HISTORY.rst
  7. 7
      pos_margin/static/description/index.html
  8. 9
      pos_margin/tests/test_module.py

1
pos_margin/README.rst

@ -93,6 +93,7 @@ Contributors
* Sylvain LE GAL (https://twitter.com/legalsylvain) * Sylvain LE GAL (https://twitter.com/legalsylvain)
* Wolfgang Pichler * Wolfgang Pichler
* Murtaza Mithaiwala (https://twitter.com/MurtazaMithaiw4)
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~

2
pos_margin/__manifest__.py

@ -5,7 +5,7 @@
{ {
'name': 'PoS Order Margin', 'name': 'PoS Order Margin',
'summary': 'Margin on PoS Order', 'summary': 'Margin on PoS Order',
'version': '12.0.1.0.0',
'version': '13.0.1.0.0',
'category': 'Point Of Sale', 'category': 'Point Of Sale',
'author': "GRAP," 'author': "GRAP,"
"Odoo Community Association (OCA)", "Odoo Community Association (OCA)",

1
pos_margin/models/pos_order.py

@ -17,7 +17,6 @@ class PosOrder(models.Model):
" the Unit Price and the cost price.") " the Unit Price and the cost price.")
# Compute Section # Compute Section
@api.multi
@api.depends('lines.margin') @api.depends('lines.margin')
def _compute_margin(self): def _compute_margin(self):
for order in self: for order in self:

1
pos_margin/models/pos_order_line.py

@ -19,7 +19,6 @@ class PosOrderLine(models.Model):
multi='multi_margin', digits=dp.get_precision('Product Price')) multi='multi_margin', digits=dp.get_precision('Product Price'))
# Compute Section # Compute Section
@api.multi
@api.depends('product_id', 'qty', 'price_subtotal') @api.depends('product_id', 'qty', 'price_subtotal')
def _compute_multi_margin(self): def _compute_multi_margin(self):
for line in self.filtered('product_id'): for line in self.filtered('product_id'):

1
pos_margin/readme/CONTRIBUTORS.rst

@ -1,2 +1,3 @@
* Sylvain LE GAL (https://twitter.com/legalsylvain) * Sylvain LE GAL (https://twitter.com/legalsylvain)
* Wolfgang Pichler * Wolfgang Pichler
* Murtaza Mithaiwala (https://twitter.com/MurtazaMithaiw4)

4
pos_margin/readme/HISTORY.rst

@ -1,7 +1,7 @@
12.0.1.0.0
13.0.1.0.0
~~~~~~~~~~ ~~~~~~~~~~
* Migrate to V12.0
* Migrate to V13.0
* Reuse ``sale_margin`` computation to handle multi currency context. * Reuse ``sale_margin`` computation to handle multi currency context.
* Correct computation of margin, if a module that adds ``uom_id`` on * Correct computation of margin, if a module that adds ``uom_id`` on
``pos.order.line`` is installed. ``pos.order.line`` is installed.

7
pos_margin/static/description/index.html

@ -413,9 +413,9 @@ for exemple).</p>
<div class="section" id="changelog"> <div class="section" id="changelog">
<h1><a class="toc-backref" href="#id4">Changelog</a></h1> <h1><a class="toc-backref" href="#id4">Changelog</a></h1>
<div class="section" id="id1"> <div class="section" id="id1">
<h2><a class="toc-backref" href="#id5">12.0.1.0.0</a></h2>
<h2><a class="toc-backref" href="#id5">13.0.1.0.0</a></h2>
<ul class="simple"> <ul class="simple">
<li>Migrate to V12.0</li>
<li>Migrate to V13.0</li>
<li>Reuse <tt class="docutils literal">sale_margin</tt> computation to handle multi currency context.</li> <li>Reuse <tt class="docutils literal">sale_margin</tt> computation to handle multi currency context.</li>
<li>Correct computation of margin, if a module that adds <tt class="docutils literal">uom_id</tt> on <li>Correct computation of margin, if a module that adds <tt class="docutils literal">uom_id</tt> on
<tt class="docutils literal">pos.order.line</tt> is installed.</li> <tt class="docutils literal">pos.order.line</tt> is installed.</li>
@ -444,6 +444,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<ul class="simple"> <ul class="simple">
<li>Sylvain LE GAL (<a class="reference external" href="https://twitter.com/legalsylvain">https://twitter.com/legalsylvain</a>)</li> <li>Sylvain LE GAL (<a class="reference external" href="https://twitter.com/legalsylvain">https://twitter.com/legalsylvain</a>)</li>
<li>Wolfgang Pichler</li> <li>Wolfgang Pichler</li>
<li>Murtaza Mithaiwala (<a class="reference external" href="https://twitter.com/MurtazaMithaiw4">https://twitter.com/MurtazaMithaiw4</a>)</li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
@ -453,7 +454,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/pos/tree/12.0/pos_margin">OCA/pos</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/pos/tree/13.0/pos_margin">OCA/pos</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>

9
pos_margin/tests/test_module.py

@ -46,13 +46,13 @@ class TestModule(TransactionCase):
'price_subtotal_incl': 18.0, 'price_subtotal_incl': 18.0,
}]], }]],
'statement_ids': [[0, 0, { 'statement_ids': [[0, 0, {
'journal_id': self.pos_config.journal_ids[0].id,
'payment_method_id':
self.pos_config.payment_method_ids[0].id,
'amount': 18.0, 'amount': 18.0,
'name': fields.Datetime.now(), 'name': fields.Datetime.now(),
'account_id': 'account_id':
self.env.user.partner_id.property_account_receivable_id.id, self.env.user.partner_id.property_account_receivable_id.id,
'statement_id':
self.pos_config.current_session_id.statement_ids[0].id,
'session_id' : self.pos_config.current_session_id.id,
}]], }]],
'creation_date': u'2018-09-27 15:51:03', 'creation_date': u'2018-09-27 15:51:03',
'amount_tax': 0, 'amount_tax': 0,
@ -62,7 +62,6 @@ class TestModule(TransactionCase):
'sequence_number': 1, 'sequence_number': 1,
'amount_total': 18.0, 'amount_total': 18.0,
}} }}
result = self.PosOrder.create_from_ui([order_data]) result = self.PosOrder.create_from_ui([order_data])
order = self.PosOrder.browse(result[0])
order = self.PosOrder.browse(result[0].get('id'))
return order return order
Loading…
Cancel
Save