Compare commits

...

2 Commits
main ... 19.0

Author SHA1 Message Date
f7ffb8b16d initial odoo 19 changes 2025-11-12 16:00:05 +07:00
3328179534 change to odoo 19 2025-11-12 15:59:12 +07:00
28 changed files with 469 additions and 456 deletions

View File

@ -1,6 +1,6 @@
{
'name': 'Purchase Advance Payment',
'version': '17.0.1.0.0',
'version': '19.0.1.0.0',
'category': 'Purchase',
'summary': 'Link payments to purchase orders as advance payments',
'description': """

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -25,13 +25,13 @@
</field>
</record>
<!-- Account Payment Tree View -->
<!-- Account Payment List View -->
<record id="view_account_payment_tree_inherit_advance_payment" model="ir.ui.view">
<field name="name">account.payment.tree.inherit.advance.payment</field>
<field name="model">account.payment</field>
<field name="inherit_id" ref="account.view_account_payment_tree"/>
<field name="arch" type="xml">
<xpath expr="//tree/field[@name='partner_id']" position="after">
<xpath expr="//list/field[@name='partner_id']" position="after">
<field name="purchase_order_id"/>
</xpath>
</field>

View File

@ -29,21 +29,21 @@
string="Link Advance Payment"
type="action"
class="btn-secondary"
context="{'default_purchase_order_id': active_id}"/>
context="{'default_purchase_order_id': id}"/>
</group>
<field name="advance_payment_ids">
<tree>
<list>
<field name="name"/>
<field name="date"/>
<field name="amount" widget="monetary"/>
<field name="state"/>
<field name="journal_id"/>
</tree>
</list>
</field>
</page>
</xpath>
<xpath expr="//field[@name='order_line']/tree/field[@name='price_unit']" position="after">
<xpath expr="//field[@name='order_line']/list/field[@name='price_unit']" position="after">
<field name="is_deposit" invisible="1"/>
</xpath>

View File

@ -11,12 +11,18 @@
<h2>Advance Payment</h2>
<div class="row mt16 o_settings_container">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="deposit_product_id"/>
<label for="deposit_product_id"/>
<div class="o_setting_left_pane" />
<div class="o_setting_right_pane">
<label
for="deposit_product_id"
string="Advance Payments"
/>
<div class="text-muted">
Default product used for advance payment deposits
</div>
<div class="text-muted">
<field name="deposit_product_id" />
</div>
</div>
</div>
</div>

Binary file not shown.

Binary file not shown.

View File

@ -30,15 +30,22 @@ class LinkAdvancePaymentWizard(models.TransientModel):
def default_get(self, fields):
res = super().default_get(fields)
# Handle context from purchase order
if self._context.get('active_model') == 'purchase.order' and self._context.get('active_id'):
po = self.env['purchase.order'].browse(self._context['active_id'])
if self.env.context.get('active_model') == 'purchase.order' and self.env.context.get('active_id'):
po = self.env['purchase.order'].browse(self.env.context['active_id'])
res['purchase_order_id'] = po.id
res['currency_id'] = po.currency_id.id
if 'amount' in fields:
res['amount'] = po.amount_residual
# Handle context from purchase order when called from the button (using default_purchase_order_id)
elif self.env.context.get('default_purchase_order_id'):
po = self.env['purchase.order'].browse(self.env.context['default_purchase_order_id'])
res['purchase_order_id'] = po.id
res['currency_id'] = po.currency_id.id
if 'amount' in fields and 'amount' not in res:
res['amount'] = po.amount_residual
# Handle context from payment
elif self._context.get('active_model') == 'account.payment' and self._context.get('active_id'):
payment = self.env['account.payment'].browse(self._context['active_id'])
elif self.env.context.get('active_model') == 'account.payment' and self.env.context.get('active_id'):
payment = self.env['account.payment'].browse(self.env.context['active_id'])
res['payment_id'] = payment.id
res['currency_id'] = payment.currency_id.id
if 'amount' in fields: